<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>SUPERFACT:  Fichier source de /home/diallo/Jeu_wordox/projet-wordox/src/Chevalet.c</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Généré par Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">SUPERFACT</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Page&#160;principale</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Fichiers</span></a></li>
      <li><a href="dirs.html"><span>Répertoires</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Liste&#160;des&#160;fichiers</span></a></li>
      <li><a href="globals.html"><span>Membres&#160;de&#160;fichier</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('_chevalet_8c.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">Chevalet.c</div>  </div>
</div>
<div class="contents">
<a href="_chevalet_8c.html">Aller à la documentation de ce fichier.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include &quot;<a class="code" href="_chevalet_8h.html">Chevalet.h</a>&quot;</span>
<a name="l00002"></a>00002 
<a name="l00003"></a>00003 
<a name="l00004"></a>00004 
<a name="l00005"></a><a class="code" href="_chevalet_8h.html#ae58f407146cf5ab8ef2a9200bf818222">00005</a> <span class="keywordtype">void</span> <a class="code" href="_chevalet_8c.html#ae58f407146cf5ab8ef2a9200bf818222">chevRemplir</a>(<a class="code" href="struct_chevalet.html" title="structure contenant l&#39;ensemble des lettres jouables">Chevalet</a> * pChev)
<a name="l00006"></a>00006 {
<a name="l00007"></a>00007    <span class="keywordtype">int</span> i;
<a name="l00008"></a>00008    <a class="code" href="struct_sac_lettres.html">SacLettres</a> pSac;
<a name="l00009"></a>00009    <a class="code" href="_sac_lettres_8c.html#a1ba9467d5a4ab4f3548bfb04c95610ff" title="une procedure permettant d&#39;initialiser un tableau de lettres">sacInitialiser</a>(&amp;pSac);
<a name="l00010"></a>00010    srand(time(NULL));
<a name="l00011"></a>00011    <span class="keywordflow">for</span>(i=0;i&lt;6;i++)
<a name="l00012"></a>00012    {
<a name="l00013"></a>00013        <span class="keywordflow">if</span>(pChev-&gt;tabLettres[i]==<span class="charliteral">&#39;\0&#39;</span>)
<a name="l00014"></a>00014 
<a name="l00015"></a>00015         pChev-&gt;tabLettres[i]=<a class="code" href="_sac_lettres_8c.html#aa839625efa47b9fc4670441333e528dc" title="une procedure permettant une lettre du tableau">getLettres</a>(&amp;pSac);
<a name="l00016"></a>00016    }
<a name="l00017"></a>00017    <a class="code" href="_sac_lettres_8c.html#ab5dc3bbc2c2b97f585835ecdf3f83016" title="une procedure permettant de liberer un tableau de lettres">sacLiberer</a>(&amp;pSac);
<a name="l00018"></a>00018 }
<a name="l00019"></a>00019 
<a name="l00020"></a><a class="code" href="_chevalet_8h.html#a2b250a0dcbfe15837a54eb7ab3dcad24">00020</a> <span class="keywordtype">char</span> <a class="code" href="_chevalet_8c.html#aee4afe9754521b95427de6442d612383" title="fonction permettant de récupérer une lettre du chevalet">chevGetLettre</a>(<a class="code" href="struct_chevalet.html" title="structure contenant l&#39;ensemble des lettres jouables">Chevalet</a> * pChev,<span class="keyword">const</span> <span class="keywordtype">int</span> i)
<a name="l00021"></a>00021 {
<a name="l00022"></a>00022  <span class="keywordflow">return</span> pChev-&gt;tabLettres[i];
<a name="l00023"></a>00023 }
<a name="l00024"></a>00024 
<a name="l00025"></a><a class="code" href="_chevalet_8h.html#a8fe9af63897538b44ddacd4343a03851">00025</a> <span class="keywordtype">int</span> <a class="code" href="_chevalet_8c.html#a5e13cb8ea03d572f7d483b074a707975" title="fonction permettant de rechercher une lettre du chevalet">chevRechLettre</a>(<a class="code" href="struct_chevalet.html" title="structure contenant l&#39;ensemble des lettres jouables">Chevalet</a> * pChev,<span class="keywordtype">char</span> lettre)
<a name="l00026"></a>00026 { <span class="keywordtype">int</span> i,res;
<a name="l00027"></a>00027   res=0;
<a name="l00028"></a>00028     <span class="keywordflow">for</span>(i=0;i&lt;6;i++)
<a name="l00029"></a>00029     {
<a name="l00030"></a>00030         <span class="keywordflow">if</span>(pChev-&gt;tabLettres[i]==lettre)
<a name="l00031"></a>00031         {
<a name="l00032"></a>00032             res=1;
<a name="l00033"></a>00033         }
<a name="l00034"></a>00034 
<a name="l00035"></a>00035     }
<a name="l00036"></a>00036     <span class="keywordflow">if</span>(res==0) <span class="keywordflow">return</span> -1;
<a name="l00037"></a>00037     <span class="keywordflow">else</span> <span class="keywordflow">return</span> i;
<a name="l00038"></a>00038 }
<a name="l00039"></a>00039 
<a name="l00040"></a><a class="code" href="_chevalet_8h.html#ad8caf66cdfe49116a3b470c007aa7058">00040</a> <span class="keywordtype">void</span> <a class="code" href="_chevalet_8c.html#a45b8cde70dd92aef26df875c12861ec0" title="fonction permettant de supprimer une lettre du chevalet">chevSuppLettre</a>(<a class="code" href="struct_chevalet.html" title="structure contenant l&#39;ensemble des lettres jouables">Chevalet</a> * pChev,<span class="keyword">const</span> <span class="keywordtype">int</span> indice)
<a name="l00041"></a>00041 {
<a name="l00042"></a>00042    pChev-&gt;tabLettres[indice]=<span class="charliteral">&#39;\0&#39;</span>;
<a name="l00043"></a>00043 }
<a name="l00044"></a>00044 
<a name="l00045"></a><a class="code" href="_chevalet_8h.html#a8162f2803a8c20dfe0398a75a4b258b5">00045</a> <span class="keywordtype">void</span> <a class="code" href="_chevalet_8c.html#af885c85d48e0afd59769aa0d454183a3" title="procédure permettant d&#39;initiliaser notre chevalet à vide">chevInitialiser</a>(<a class="code" href="struct_chevalet.html" title="structure contenant l&#39;ensemble des lettres jouables">Chevalet</a> * pChev)
<a name="l00046"></a>00046 {
<a name="l00047"></a>00047     <a class="code" href="struct_sac_lettres.html">SacLettres</a> pSac;
<a name="l00048"></a>00048     <span class="keywordtype">int</span> i;
<a name="l00049"></a>00049 
<a name="l00050"></a>00050     <a class="code" href="_sac_lettres_8c.html#a1ba9467d5a4ab4f3548bfb04c95610ff" title="une procedure permettant d&#39;initialiser un tableau de lettres">sacInitialiser</a>(&amp;pSac);
<a name="l00051"></a>00051     pChev-&gt;tabLettres=(<span class="keywordtype">char</span> *) malloc(<span class="keyword">sizeof</span>(<span class="keywordtype">char</span>)*6);
<a name="l00052"></a>00052      <span class="keywordflow">for</span>(i=0;i&lt;6;i++)
<a name="l00053"></a>00053    {
<a name="l00054"></a>00054        pChev-&gt;tabLettres[i]=<span class="charliteral">&#39;\0&#39;</span>;
<a name="l00055"></a>00055    }
<a name="l00056"></a>00056     <a class="code" href="_chevalet_8c.html#ae58f407146cf5ab8ef2a9200bf818222">chevRemplir</a>(pChev);
<a name="l00057"></a>00057     <a class="code" href="_sac_lettres_8c.html#ab5dc3bbc2c2b97f585835ecdf3f83016" title="une procedure permettant de liberer un tableau de lettres">sacLiberer</a>(&amp;pSac);
<a name="l00058"></a>00058 
<a name="l00059"></a>00059 }
<a name="l00060"></a>00060 
<a name="l00061"></a><a class="code" href="_chevalet_8h.html#a31dd86cad30d539a4f0a44185ecb40b0">00061</a> <span class="keywordtype">void</span> <a class="code" href="_chevalet_8c.html#a8d5d52690fa8ab73cf3159d729e12b93" title="fonction permettant de chager une lettre dans le chevalet">chevSet</a>(<a class="code" href="struct_chevalet.html" title="structure contenant l&#39;ensemble des lettres jouables">Chevalet</a> * pChev, <span class="keyword">const</span> <span class="keywordtype">int</span> indice,<span class="keyword">const</span> <span class="keywordtype">char</span> lettre)
<a name="l00062"></a>00062 {
<a name="l00063"></a>00063     pChev-&gt;tabLettres[indice]=lettre;
<a name="l00064"></a>00064 }
<a name="l00065"></a>00065 
<a name="l00066"></a><a class="code" href="_chevalet_8h.html#a59a3d2e116fef5b2a4ac04724430d3ef">00066</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="_chevalet_8c.html#afaa609c7468e3c29f78b1bc65146aa31" title="fonction permettant de tester si une case est vide">chevTestCaseVide</a>(<a class="code" href="struct_chevalet.html" title="structure contenant l&#39;ensemble des lettres jouables">Chevalet</a> * pChev,<span class="keyword">const</span> <span class="keywordtype">int</span> indice)
<a name="l00067"></a>00067 {
<a name="l00068"></a>00068     <span class="keywordflow">if</span>(pChev-&gt;tabLettres[indice]==<span class="charliteral">&#39;\0&#39;</span>) <span class="keywordflow">return</span> 1;
<a name="l00069"></a>00069     <span class="keywordflow">else</span> <span class="keywordflow">return</span> 0;
<a name="l00070"></a>00070 }
<a name="l00071"></a>00071 
<a name="l00072"></a><a class="code" href="_chevalet_8h.html#a0cf08f02f5b8eb624a6151b9d098d6f3">00072</a> <span class="keywordtype">void</span> <a class="code" href="_chevalet_8c.html#a51506d7f3c4f23ea2dc1041ef783e29a" title="procédure permettant de liberer notre chevalet à vide">chevLiberer</a>(<a class="code" href="struct_chevalet.html" title="structure contenant l&#39;ensemble des lettres jouables">Chevalet</a> * pChev)
<a name="l00073"></a>00073 {
<a name="l00074"></a>00074     free(pChev-&gt;tabLettres);
<a name="l00075"></a>00075 }
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="_chevalet_8c.html">Chevalet.c</a>      </li>
      <li class="footer">Généré le Thu Nov 29 2012 17:24:07 pour SUPERFACT par&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </li>
    </ul>
  </div>

</body>
</html>
